<?php
/**
 * @copyright SYS Company
 * @author : Mr  Nguyễn Hoàng Long
 * @version : 1.0
 * @name : CRUD Class
 * @todo:  Lớp  mở rộng của CModule. Thao tác danh sách, sửa, xóa cơ sở.
*/
class VimuaToolbar extends CModule {
	function draw() {
		$admin_url = '';
		$user = user();
		if($user->is_admin()) {
			$admin_url = url('admin', array(), '', 'rewrite');
		} else if($user->is_login()) {
			foreach($user->privileges as $privileges) {
				foreach($privileges as $privilege=>$value) {
					if($privilege != 'Salesman') {
						$admin_url = url('admin', array(), '', 'rewrite');
						break;
					}
				}
			}
		}
		CForm($this->path().'/layout.tpl')->parse(array(
			'admin_url'=>$admin_url,
			'widget_num_items'=>sizeof(CTable(CStore(session('widget')))->select_all()),
		));
 	}
 }
?>